package cn.hsw.manage.user.mapper;

import cn.hsw.manage.user.entity.User;
import cn.hsw.manage.user.vo.UserDetailVo;
import cn.hsw.manage.user.vo.UserListVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 李子木
 * @since 2021-11-03 08:55:22
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Select("select * from hsw_manage_user where phone = #{phone}")
    User selectUserByPhone(@Param("phone")String phone);

    IPage<UserListVo> findByUserNameAndPhoneLike(@Param("userName")String userName, @Param("phone") String phone, Page page);

    @Select("select * from hsw_manage_user where user_name = #{userName}")
    User findByUserName(@Param("userName")String userName);

    UserDetailVo findByPid(@Param("pid") Long pid);
}
